Skip to content

fix: Use the reserved listener address for Docker port bindings#131

Open
nowooj wants to merge 1 commit into
cosmos:mainfrom
nowooj:fix/port-binding
Open

fix: Use the reserved listener address for Docker port bindings#131
nowooj wants to merge 1 commit into
cosmos:mainfrom
nowooj:fix/port-binding

Conversation

@nowooj
Copy link
Copy Markdown
Contributor

@nowooj nowooj commented May 21, 2026

Summary

This changes GetPort to derive Docker PortBinding.HostIP and HostPort from the actual TCP listener address.

Previously, interchaintest reserved ports by opening a listener on 127.0.0.1:<port>, but returned a Docker port binding with HostIP: "0.0.0.0". This meant the reserved host address and the Docker publish address
could differ.

With this change, the returned PortBinding is built from the listener itself:

Motivation

OpenListener is the source of truth for reserving an available host port. The Docker PortBinding should use the same bound address rather than independently choosing a different host IP.

This matters on newer Docker versions where bridge networking and port publishing behavior has been tightened. Docker Engine 28 changed port publishing and bridge-network firewall behavior, and Docker documents that
binding to 127.0.0.1 restricts the published port to the Docker host.

Behavior Change

Instead of always publishing reserved ports on 0.0.0.0, interchaintest now publishes the port on the same IP address that was actually reserved by the temporary listener.

For the current OpenListener implementation, this means Docker receives 127.0.0.1:, matching the listener reservation.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 21, 2026

PR author is not in the allowed authors list.

@nowooj nowooj changed the title Use the reserved listener address for Docker port bindings fix: Use the reserved listener address for Docker port bindings May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant